package com.yanqu.road.dao.impl.servercenter;

import com.yanqu.road.dao.db.DbNameStrategy;
import com.yanqu.road.dao.impl.TempDao;
import com.yanqu.road.entity.servercenter.PackageMark;

import java.sql.CallableStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;

/**
 * 包体标识信息
 */
public class PackageMarkDaoImpl extends TempDao {

	public List<PackageMark> getPackageMarkList() {
		ResultSet rs = null;
		CallableStatement call = null;
		String sql = "select * from t_s_package_mark";
		List<PackageMark> dataList = new ArrayList<>();
		try {
			getDb().setConnName(DbNameStrategy.getServerDb());
			call = getDb().getConnection().prepareCall(sql);
			rs = call.executeQuery();
			while (rs.next()) {
				PackageMark data = new PackageMark();
				data.setPackageMark(rs.getString("packageMark"));
				data.setChannelId(rs.getInt("channelId"));
				data.setPhonePlatform(rs.getInt("phonePlatform"));
				data.setHotPackDownloadUrl(rs.getString("hotPackDownloadUrl"));
				dataList.add(data);
			}
		} catch (Exception e) {
			throw new RuntimeException(e);
		} finally {
			getDb().closeConnection(call, rs);
		}
		return dataList;
	}
}
